#include "fxcc/yml/Serializer.h"
#include "fxcc/core/graph/common/Channel.h"

using namespace fxcc::yml;
using namespace fxcc::graph::common;
using CType = fxcc::graph::common::Channel;

template<>
void Serializer::Encode<CType>(YAML::Node& node, const CType& inst)
{
	Encode<fxcc::Base>(node, inst);
	SetVariable<std::string>(node, "m_NodeName", inst.m_NodeName);
	SetVariable<double>(node, "m_Duration", inst.m_Duration);
	//SetVariable<VoidPtrMap>(node, "m_VoidPtrMap", inst.m_VoidPtrMap);
	SetArrayVariable<PositionKey>(node, "m_PositionKeys", inst.m_PositionKeys);
	SetArrayVariable<RotationKey>(node, "m_RotationKeys", inst.m_RotationKeys);
	SetArrayVariable<ScaleKey>(node, "m_ScaleKeys", inst.m_ScaleKeys);

}


template<>
bool Serializer::Decode<CType>(const YAML::Node& node, CType& inst)
{
	Decode<fxcc::Base>(node, inst);
	GetVariable<std::string>(node, "m_NodeName", inst.m_NodeName);
	GetVariable<double>(node, "m_Duration", inst.m_Duration);
	//GetVariable<VoidPtrMap>(node, "m_VoidPtrMap", inst.m_VoidPtrMap);
	GetArrayVariable<PositionKey>(node, "m_PositionKeys", inst.m_PositionKeys);
	GetArrayVariable<RotationKey>(node, "m_RotationKeys", inst.m_RotationKeys);
	GetArrayVariable<ScaleKey>(node, "m_ScaleKeys", inst.m_ScaleKeys);

	return true;
}
